<?php

class address_unit_value extends entity
{
    public $structs = [
        'value' => '',
        'status' => '',
        'address_unit_turn_id' => '',
        'before_address_unit_value_id' => '',
    ];

public static $entity_display_name = '地址单位值';
    public static $entity_description = '地址单位值';

    public static $struct_types = [
        'value' => 'text',
        'status' => 'enum',
        'address_unit_turn_id' => 'number',
        'before_address_unit_value_id' => 'number',
    ];

    public static $struct_display_names = [
        'value' => '值',
        'status' => '状态',
        'address_unit_turn_id' => '地址单位顺序ID',
        'before_address_unit_value_id' => '地址单位值ID',
    ];

    public static $struct_descriptions = [
        'value' => '值',
        'status' => '状态',
        'address_unit_turn_id' => '地址单位顺序ID',
        'before_address_unit_value_id' => '地址单位值ID',
    ];

    const STATUS_INIT = 'INIT';
    const STATUS_VALID = 'VALID';
    const STATUS_INVALID = 'INVALID';

    const STATUS_MAPS = [
        self::STATUS_INIT => '初始化状态',
        self::STATUS_VALID => '有效',
        self::STATUS_INVALID => '无效',
    ];

    public static $struct_formats = [
        'status' => self::STATUS_MAPS,
    ];

    public static $struct_format_descriptions = [
        'status' => '',
    ];

    public function __construct()
    {/*{{{*/
        $this->belongs_to('address_unit_turn');
        $this->belongs_to('before_address_unit_value', 'address_unit_value', 'before_address_unit_value_id');
    }/*}}}*/

    public static function create()
    {/*{{{*/
        return parent::init();
    }/*}}}*/

    public function get_status_description()
    {/*{{{*/
        return self::STATUS_MAPS[$this->status];
    }/*}}}*/

    public function set_status_init()
    {/*{{{*/
        return $this->status = self::STATUS_INIT;
    }/*}}}*/
}
